//
//  PKAppleReceipModal.swift
//  GoAbroad
//
//  Created by Pink Snow on 2025/5/26.
//

import Foundation
import ObjectMapper
class PKAppleReceipModal: Mappable {
    var status: Int?
    var receipt: AppleReceipt?
    var latestReceiptInfo: [InAppPurchase]?

    required init?(map: Map) {}

    func mapping(map: Map) {
        status             <- map["status"]
        receipt            <- map["receipt"]
        latestReceiptInfo  <- map["latest_receipt_info"]
    }
}
class AppleReceipt: Mappable {
    var receiptType: String?
    var adamID: Int?
    var appItemID: Int?
    var bundleID: String?
    var applicationVersion: String?
    var downloadID: Int?
    var versionExternalIdentifier: Int?
    var receiptCreationDate: String?
    var receiptCreationDateMs: String?
    var receiptCreationDatePst: String?
    var requestDate: String?
    var requestDateMs: String?
    var requestDatePst: String?
    var originalPurchaseDate: String?
    var originalPurchaseDateMs: String?
    var originalPurchaseDatePst: String?
    var originalApplicationVersion: String?
    var inApp: [InAppPurchase]?

    required init?(map: Map) {}

    func mapping(map: Map) {
        receiptType                <- map["receipt_type"]
        adamID                     <- map["adam_id"]
        appItemID                  <- map["app_item_id"]
        bundleID                   <- map["bundle_id"]
        applicationVersion         <- map["application_version"]
        downloadID                 <- map["download_id"]
        versionExternalIdentifier  <- map["version_external_identifier"]
        receiptCreationDate        <- map["receipt_creation_date"]
        receiptCreationDateMs      <- map["receipt_creation_date_ms"]
        receiptCreationDatePst     <- map["receipt_creation_date_pst"]
        requestDate                <- map["request_date"]
        requestDateMs              <- map["request_date_ms"]
        requestDatePst             <- map["request_date_pst"]
        originalPurchaseDate       <- map["original_purchase_date"]
        originalPurchaseDateMs     <- map["original_purchase_date_ms"]
        originalPurchaseDatePst    <- map["original_purchase_date_pst"]
        originalApplicationVersion <- map["original_application_version"]
        inApp                      <- map["in_app"]
    }
}
class InAppPurchase: Mappable {
    var quantity: String?
    var productID: String?
    var transactionID: String?
    var originalTransactionID: String?
    var purchaseDate: String?
    var purchaseDateMs: String?
    var purchaseDatePst: String?
    var originalPurchaseDate: String?
    var originalPurchaseDateMs: String?
    var originalPurchaseDatePst: String?
    var expiresDate: String?
    var expiresDateMs: String?
    var expiresDatePst: String?
    var webOrderLineItemID: String?
    var isTrialPeriod: String?
    var isInIntroOfferPeriod: String?

    required init?(map: Map) {}

    func mapping(map: Map) {
        quantity                <- map["quantity"]
        productID               <- map["product_id"]
        transactionID           <- map["transaction_id"]
        originalTransactionID   <- map["original_transaction_id"]
        purchaseDate            <- map["purchase_date"]
        purchaseDateMs          <- map["purchase_date_ms"]
        purchaseDatePst         <- map["purchase_date_pst"]
        originalPurchaseDate    <- map["original_purchase_date"]
        originalPurchaseDateMs  <- map["original_purchase_date_ms"]
        originalPurchaseDatePst <- map["original_purchase_date_pst"]
        expiresDate             <- map["expires_date"]
        expiresDateMs           <- map["expires_date_ms"]
        expiresDatePst          <- map["expires_date_pst"]
        webOrderLineItemID      <- map["web_order_line_item_id"]
        isTrialPeriod           <- map["is_trial_period"]
        isInIntroOfferPeriod    <- map["is_in_intro_offer_period"]
    }
}
